
#include "stm32f10x.h"
#include "stm32f10x_spi.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_usart.h"
#include "stm32f10x_exti.h"
#include "misc.h"

#include "hw_config.h"


// This init must be first for proper GPIO/irq initialization
// Add GPIOs according to peripherials

void gpio_hw_init()
{
    GPIO_InitTypeDef port;

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);

    // GPIOs
    GPIO_StructInit(&port);
    port.GPIO_Mode = GPIO_Mode_Out_PP;
    port.GPIO_Pin = LED1_PIN | LED2_PIN;
    port.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOB, &port);

    // NVIC
    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);

}

